﻿using PSI.Models.DModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PSI.DAL
{
       public  class StoreDAL:BaseDAL<StoreInfoModel>
        {
                /// <summary>
                /// 获取指定类别的仓库列表
                /// </summary>
                /// <param name="typeId"></param>
                /// <returns></returns>
                public List<StoreInfoModel> GetStoresByTypeId(int typeId)
                {
                        List<StoreInfoModel> list =  GetModelList($"IsDeleted=0 and STypeId={typeId}", "StoreId,StoreName,StoreNo");
                        return list;
                }

                /// <summary>
                /// 获取所有的仓库编号集合
                /// </summary>
                /// <returns></returns>
                public List<int> GetAllStoreIds()
                {
                        List<StoreInfoModel> stores = GetModelList("IsDeleted=0", "StoreId");
                        List<int> ids = new List<int>();
                        if (stores.Count > 0)
                                ids = stores.Select(s => s.StoreId).ToList();
                        return ids;
                }
        }
}
